﻿using System;
using System.Diagnostics.Contracts;
using System.Windows;
using System.Windows.Interop;

namespace DaveSexton.Labs
{
	internal sealed class NativeWindow : System.Windows.Forms.IWin32Window
	{
		#region Public Properties
		public IntPtr Handle
		{
			get
			{
				return new WindowInteropHelper(window).Handle;
			}
		}
		#endregion

		#region Private / Protected
		private readonly Window window;
		#endregion

		#region Constructors
		public NativeWindow(Window window)
		{
			Contract.Requires(window != null);

			this.window = window;
		}
		#endregion

		#region Methods
		[ContractInvariantMethod]
		[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Justification = "Required for code contracts.")]
		private void ObjectInvariant()
		{
			Contract.Invariant(window != null);
		}
		#endregion
	}
}